// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({
  env: 'timemechine-6gk33n8ja79a3c4a'
})

// 云函数入口函数
exports.main = async (event, context) => {
  if(event.all){
    return cloud.database().collection('mission_list').where({
      "_openid": event.openid,
    })
    .get();
  }else{
    return cloud.database().collection('mission_list').where({
      "_openid": event.openid,
      "date": event.date
    })
    .get();
  }
}